package pokerAI.PokerAI;
import java.io.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Stack;
import java.util.Random;
import java.lang.Math;
import java.lang.String;

class Card {        
        private int number;
        private char suit;
        private Integer[][] imageIDs = {
                {
	                R.drawable.clubs1,
	                R.drawable.clubs2,
	                R.drawable.clubs3,
	                R.drawable.clubs4,
	                R.drawable.clubs5,
	                R.drawable.clubs6,
	                R.drawable.clubs7, 
	                R.drawable.clubs8,
	                R.drawable.clubs9,
	                R.drawable.clubs10,
	                R.drawable.clubs11,
	                R.drawable.clubs12,
	                R.drawable.clubs13
                },
                {
                	R.drawable.diamonds1,
	                R.drawable.diamonds2,
	                R.drawable.diamonds3,
	                R.drawable.diamonds4,
	                R.drawable.diamonds5,
	                R.drawable.diamonds6,
	                R.drawable.diamonds7,
	                R.drawable.diamonds8,
	                R.drawable.diamonds9,
	                R.drawable.diamonds10,
	                R.drawable.diamonds11,
	                R.drawable.diamonds12,
	                R.drawable.diamonds13
	            },
                {
	            	R.drawable.hearts1,
                	R.drawable.hearts2,
                	R.drawable.hearts3,
                	R.drawable.hearts4,
                	R.drawable.hearts5,
                	R.drawable.hearts6,
                	R.drawable.hearts7,
                	R.drawable.hearts8,
                	R.drawable.hearts9,
                	R.drawable.hearts10,
                	R.drawable.hearts11,
                	R.drawable.hearts12,
                	R.drawable.hearts13,
                },
                {
	            	R.drawable.spades1,
	            	R.drawable.spades2,
	            	R.drawable.spades3,
	            	R.drawable.spades4,
	            	R.drawable.spades5,
	            	R.drawable.spades6,
	            	R.drawable.spades7,
	            	R.drawable.spades8,
	            	R.drawable.spades9,
	            	R.drawable.spades10,
	            	R.drawable.spades11,
	            	R.drawable.spades12,
	            	R.drawable.spades13
	            }     
        };
        private Integer[][] imageIDsHalf = {
                {
	                R.drawable.clubs1half,
	                R.drawable.clubs2half,
	                R.drawable.clubs3half,
	                R.drawable.clubs4half,
	                R.drawable.clubs5half,
	                R.drawable.clubs6half,
	                R.drawable.clubs7half, 
	                R.drawable.clubs8half,
	                R.drawable.clubs9half,
	                R.drawable.clubs10half,
	                R.drawable.clubs11half,
	                R.drawable.clubs12half,
	                R.drawable.clubs13half
                },
                {
                	R.drawable.diamonds1half,
	                R.drawable.diamonds2half,
	                R.drawable.diamonds3half,
	                R.drawable.diamonds4half,
	                R.drawable.diamonds5half,
	                R.drawable.diamonds6half,
	                R.drawable.diamonds7half,
	                R.drawable.diamonds8half,
	                R.drawable.diamonds9half,
	                R.drawable.diamonds10half,
	                R.drawable.diamonds11half,
	                R.drawable.diamonds12half,
	                R.drawable.diamonds13half
	            },
                {
	            	R.drawable.hearts1half,
                	R.drawable.hearts2half,
                	R.drawable.hearts3half,
                	R.drawable.hearts4half,
                	R.drawable.hearts5half,
                	R.drawable.hearts6half,
                	R.drawable.hearts7half,
                	R.drawable.hearts8half,
                	R.drawable.hearts9half,
                	R.drawable.hearts10half,
                	R.drawable.hearts11half,
                	R.drawable.hearts12half,
                	R.drawable.hearts13half
                },
                {
	            	R.drawable.spades1half,
	            	R.drawable.spades2half,
	            	R.drawable.spades3half,
	            	R.drawable.spades4half,
	            	R.drawable.spades5half,
	            	R.drawable.spades6half,
	            	R.drawable.spades7half,
	            	R.drawable.spades8half,
	            	R.drawable.spades9half,
	            	R.drawable.spades10half,
	            	R.drawable.spades11half,
	            	R.drawable.spades12half,
	            	R.drawable.spades13half
	            }     
        };
        
        private Integer[][] imageIDsMin = {
                {
	                R.drawable.clubs1min,
	                R.drawable.clubs2min,
	                R.drawable.clubs3min,
	                R.drawable.clubs4min,
	                R.drawable.clubs5min,
	                R.drawable.clubs6min,
	                R.drawable.clubs7min, 
	                R.drawable.clubs8min,
	                R.drawable.clubs9min,
	                R.drawable.clubs10min,
	                R.drawable.clubs11min,
	                R.drawable.clubs12min,
	                R.drawable.clubs13min
                },
                {
                	R.drawable.diamonds1min,
	                R.drawable.diamonds2min,
	                R.drawable.diamonds3min,
	                R.drawable.diamonds4min,
	                R.drawable.diamonds5min,
	                R.drawable.diamonds6min,
	                R.drawable.diamonds7min,
	                R.drawable.diamonds8min,
	                R.drawable.diamonds9min,
	                R.drawable.diamonds10min,
	                R.drawable.diamonds11min,
	                R.drawable.diamonds12min,
	                R.drawable.diamonds13min
	            },
                {
	            	R.drawable.hearts1min,
                	R.drawable.hearts2min,
                	R.drawable.hearts3min,
                	R.drawable.hearts4min,
                	R.drawable.hearts5min,
                	R.drawable.hearts6min,
                	R.drawable.hearts7min,
                	R.drawable.hearts8min,
                	R.drawable.hearts9min,
                	R.drawable.hearts10min,
                	R.drawable.hearts11min,
                	R.drawable.hearts12min,
                	R.drawable.hearts13min
                },
                {
	            	R.drawable.spades1min,
	            	R.drawable.spades2min,
	            	R.drawable.spades3min,
	            	R.drawable.spades4min,
	            	R.drawable.spades5min,
	            	R.drawable.spades6min,
	            	R.drawable.spades7min,
	            	R.drawable.spades8min,
	            	R.drawable.spades9min,
	            	R.drawable.spades10min,
	            	R.drawable.spades11min,
	            	R.drawable.spades12min,
	            	R.drawable.spades13min
	            }     
        };

        
        public Card(){
        }
        
        public Card(int number, char suit){
                this.number = number;
                this.suit = suit;
                
                
        }
        
        public int getNumber(){
                return number;
        }
        
        public char getSuit(){
                return suit;
        }
        
        public String toString(){
                String oput;
                if(number == 13)
                        oput = "K";
                else if(number == 12)
                        oput = "Q";
                else if(number == 11)
                        oput = "J";
                else if(number == 14 || number == 1)
                        oput = "A";
                else
                        oput = "" + number;
                oput = oput + " of " + suit; 
                return oput;
        }
        
        public int imgId(String size) {
        	int cardIndex = this.number -1;
        	int suitIndex;
        	if(suit == 'c')
        		suitIndex = 0;
            else if(suit == 'd')
            	suitIndex = 1;
            else if(suit == 'h')
            	suitIndex = 2; 
            else //suit == '2'
            	suitIndex = 3; 
        	
        	if (size == "half")
        		return imageIDsHalf[suitIndex][cardIndex];
        	else if (size == "min")
        		return imageIDsMin[suitIndex][cardIndex];
        	else
        		return imageIDs[suitIndex][cardIndex];
        	
        }
}
